local skynet = require "skynet"
local filelog = require "filelog"
local msghelper = require "agenthelper"
local base = require "base"
local AgentCMD = {}

function AgentCMD.process(session, source, event, ...)
	local f = AgentCMD[event] 
	if f == nil then
		filelog.sys_error("AgentCMD.process invalid event:"..event)
		return nil
	end
	f(...)
end

function AgentCMD.start(session_id, conf)
	local result = msghelper:create_session(session_id, conf)
	--base.skynet_retpack(result)
end

function AgentCMD.close(...)
	--睡眠5s
	skynet.sleep(500)
	
	skynet.exit()	
end

return AgentCMD